package com.zziq.cloudpicturebank.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zziq.cloudpicturebank.common.BaseResponse;
import com.zziq.cloudpicturebank.model.dto.picture.PictureUploadRequest;
import com.zziq.cloudpicturebank.model.dto.user.UserQueryRequest;
import com.zziq.cloudpicturebank.model.dto.user.UserUpdateMyRequest;
import com.zziq.cloudpicturebank.model.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zziq.cloudpicturebank.model.enums.UserRoleEnum;
import com.zziq.cloudpicturebank.model.vo.picture.PictureVO;
import com.zziq.cloudpicturebank.model.vo.user.LoginUserVO;
import com.zziq.cloudpicturebank.model.vo.user.UserVO;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;

/**
* @author Mr·张
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2025-02-20 15:53:04
*/
public interface UserService extends IService<User> {
    /**
     * 用户注册
     * @param userAccount
     * @param password
     * @param checkPassword
     * @return
     */
    long userRegister(String userAccount, String password,String checkPassword);

    /**
     * 密码加密
     * @param userPassword
     * @return
     */
    String getEncryptPassword(String userPassword);

    /**
     * 用户登录
     *
     * @param userAccount  用户账户
     * @param userPassword 用户密码
     * @param request
     * @return
     */
    LoginUserVO userLogin(String userAccount, String userPassword, HttpServletRequest request);

    /**
     * 获取当前登录用户
     *
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);

    /**
     * 获取脱敏的已登录用户信息
     *
     * @return
     */
    LoginUserVO getLoginUserVO(User user);

    /**
     * 用户注销
     *
     * @param request
     * @return
     */
    boolean userLogout(HttpServletRequest request);

    /**
     * 获取脱敏的用户信息
     *
     * @param user
     * @return
     */
    UserVO getUserVO(User user);

    /**
     *
     *  获取脱敏后的 用户列表的用户信息
     * @param userList
     * @return
     */
    List<UserVO> getUserVOList(List<User> userList);

    /**
     * 根据查询请求 转为QueryWrapper 对象
     * @param userQueryRequest
     * @return
     */
    QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);

    /**
     * 是否为管理员
     *
     * @param user
     * @return
     */
    boolean isAdmin(User user);


    /**
     * 用户编辑个人信息（包括修改密码）
     * @param userUpdateMyRequest
     * @param loginUser
     * @return
     */
    boolean updateMyUser(UserUpdateMyRequest userUpdateMyRequest, User loginUser);

    /**
     * 用户兑换会员（会员码兑换）
     */
    boolean exchangeVip(User user, String vipCode);

    /**
     * 查询过期的VIP用户
     * @param currentDate
     * @return
     */
    List<User> listExpiredVipUsers(Date currentDate);
}
